<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Auth Tasks';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="auth-task-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('Create Auth Task', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
//            ['class' => 'yii\grid\SerialColumn'],

            'task_id',
            'task_name',
            'task_cat_id',
            'description',

            [
                'class' => 'yii\grid\ActionColumn',
                'template' => '{view}{update}{delete}{item}',
                'buttons' => [
                    'item' => function($url, $model, $key){
                        $url = \yii\helpers\Url::to(['rbac/index','tid' => $model->task_id]);
                        $options = [
                            'title' => '分配权限',
                            'aria-label' => '分配权限',
                        ];
                        return Html::a('<span class="fa fa-check"></span>',$url,$options);
                    }
                ],
            ],
        ],
    ]); ?>

</div>
